package com.example.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

@Service
public class AuthService {

    private final PasswordEncoder passwordEncoder;

    @Autowired
    public AuthService(PasswordEncoder passwordEncoder) {
        this.passwordEncoder = passwordEncoder;
    }

    public String register(String username, String password) {
        String encodedPassword = passwordEncoder.encode(password);
        // 保存用户和密码到数据库的逻辑
        return "注册成功";
    }

    public String login(String username, String password) {
        // 验证用户名和密码的逻辑
        return "登陆成功";
    }
}
